<meta charset="UTF-8">
<script src="https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/jquery/jquery-1.10.2.min_65682a2.js"></script>
<div id="all">
  <div id="d1">information</div>
  <div id="d2">information</div>
  <div id="d3">information</div>
</div>
<script>
    $(f);
    function f(){
        $("#d2").prev().css("background","red").
        end().next().css("background","green");
    }
</script>
